﻿using System;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;

namespace Codeplex_MSI_Autoupdate
{
    static class Example
    {
        private static string Params = "project \"Da totally awesome project\" 1.3 Prompt DirectDL";
        
        private static void Autoupdate(string Params)
        {
            //The rest is to remain
            String UpdaterFileName = @"Codeplex MSI Autoupdate.exe";
            String PathInInstallFolder = Path.Combine(Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]), UpdaterFileName);
            String PathInProjectFolder = Path.Combine(@"..\..\..\Codeplex MSI Autoupdate\bin\release",UpdaterFileName);
            if (File.Exists(PathInInstallFolder))
                Process.Start(PathInInstallFolder, Params);
            else if (File.Exists(PathInProjectFolder))
                Process.Start(PathInProjectFolder, Params);
            else
                MessageBox.Show("Missing "+UpdaterFileName);
        }
    }
}
